package com.xiaoshuidi.cloud.module.finance.service.finance;

import com.itextpdf.text.Font;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.framework.security.core.LoginUser;
import com.xiaoshuidi.cloud.module.bpm.mq.message.BpmProcessInstanceResultEvent;
import com.xiaoshuidi.cloud.module.finance.controller.admin.finance.vo.account.*;
import com.xiaoshuidi.cloud.module.finance.controller.app.finance.vo.AppFinanceAccountRechargeReqVO;
import com.xiaoshuidi.cloud.module.finance.controller.app.finance.vo.AppFinanceAccountRefundReqVO;
import com.xiaoshuidi.cloud.module.finance.dal.dataobject.finance.FinanceAccountDO;
import com.xiaoshuidi.cloud.module.finance.dal.dataobject.finance.FinanceAccountJournalExtDO;
import com.xiaoshuidi.cloud.module.finance.dal.dataobject.finance.FinanceAccountWithdrawDO;
import com.xiaoshuidi.cloud.module.finance.enums.finance.FinanceCustomerTypeEnum;
import com.xiaoshuidi.cloud.module.finance.mq.message.FinanceAccountDeductMessage;
import com.xiaoshuidi.cloud.module.finance.mq.message.PayResultMessage;
import com.xiaoshuidi.cloud.module.finance.util.pdf.PdfUtils;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;

public interface FinanceAccountService {
    void recharge(FinanceAccountCreateReqVO reqVO);

    void deduction(FinanceAccountCreateReqVO reqVO);

    PageResult<FinanceAccountJournalExtDO> getJournalPage(FinanceAccountJournalPageReqVO reqVO);


    PageResult<FinanceAccountJournalExtDO> getJournalPageDetails(FinanceAccountJournalPageReqVO reqVO);

    Boolean deduct(String custId, String custType, Long roomId, String roomName, Long tenantId,
                   Collection<FinanceAccountDeductMessage> msg) throws InterruptedException;

    FinanceAccountDO get(String custId, String custType);

    PageResult<FinanceAccountVO> getRoomAccountPage(FinanceAccountPageReqVO reqVO);

    PageResult<FinanceAccountVO> getPage(FinanceAccountPageReqVO reqVO);

    void refund(FinanceAccountRefundReqVO reqVO);

    /**
     * 个人企业预充值提现回调
     *
     * @param event
     */
    void approvalRefundResult(BpmProcessInstanceResultEvent event);

    Long createJournal(LoginUser user, AppFinanceAccountRechargeReqVO reqVO);

    void journalPayCallback(Long journalId, PayResultMessage payResultMessage);

    List<FinanceAccountDO> getAll(LoginUser user);

    void withdraw(Integer accountId, String custId, String custType, BigDecimal amount, String operator);

    FinanceWalletApplyRefundDetailsVO getWalletApplyRefundDetails(Long id);

    /**
     * 个人企业余额提现
     *
     * @param reqVO
     */
    void walletRefund(FinanceAccountRefundReqVO reqVO);

    /**
     * 个人企业预充值提现回调
     *
     * @param event
     */
    void approvalWalletRefundResult(BpmProcessInstanceResultEvent event);

    /**
     * 余额体现审批详情
     *
     * @param id
     * @return
     */
    FinanceAccountWithdrawDO getAccountWithdrawById(Long id);


    List<FinanceAccountWithdrawDO> selectListAccountWithdrawByIds(List<Long> ids);

    void getPdf(List<FinanceAccountWithdrawDO> financeAccountWithdrawDOS, PdfUtils.PdfDoc doc, Font header,
                Font bold) throws Exception;

    void updateMemberUser(Long userId, String userName, String mobile, Long oldUserId);

    /**
     * 个人账户合并
     *
     * @param userId    合并至用户id
     * @param oldUserId 原用户id
     */
    void individuAlaccountConsolidation(String userId, String phone, String oldUserId,
                                        FinanceCustomerTypeEnum customerType);

    /**
     * 个人账户修改手机号
     * @param userId
     * @param phone
     */
    void individualAccountUpdatePhone(String userId, String phone);



    /**
     * app个人余额提现
     *
     * @param reqVO
     */
    void appWithdrawal(AppFinanceAccountRefundReqVO reqVO);
}
